#include "registrar.h"
#include "student.h"
#include "curriculum.h"

/// The one-and-only Registrar instance.
Registrar* Registrar::instance_;

/// pimpl definition.
struct RegistrarImpl
{
	Student student;
	Curriculum curriculum;
};

Registrar::Registrar() :pimpl_(new RegistrarImpl())
{
}

Registrar::~Registrar()
{
    delete instance_;
}

/// Gain access to the one-and-only Registrar instance.
/// \return The one-and-only Registrar instance.
Registrar* Registrar::instance()
{
    if( instance_ == 0 )
        instance_ = new Registrar();
    return instance_;
}

/// Student setter.
void Registrar::student(const Student& newstudent)
{
	pimpl_->student = newstudent;
}

/// Curriculum setter.
void Registrar::curriculum(const Curriculum& newcurriculum)
{
	pimpl_->curriculum = newcurriculum;
}

/// Student getter.
Student Registrar::student() const
{
	return	pimpl_->student;
}

/// Curriculum getter.
const Curriculum& Registrar::curriculum() const
{
	return pimpl_->curriculum;
}
